package ch.bfh.ti.barcode;

import ch.bfh.ti.barcode.exception.DecodeException;
import ch.bfh.ti.barcode.exception.NotDetectedException;

/**
 * This interface describes a class with the ability to transform an image with
 * a barcode into a byte array with the actual data of the barcode.
 * 
 * @author Dominik von Burg
 * 
 */
public interface CodeReader {
	/**
	 * This method reads the data of the barcode from a barcode image. The image
	 * has to be provided in the ARGB format. The data is returned as a byte
	 * array.
	 * 
	 * @param source
	 *            An image with the barcode. The image has to be in the ARGB
	 *            format.
	 * @return The decoded data extracted from the barcode image.
	 * @throws NotDetectedException
	 *             The barcode could not be found in the image.
	 * @throws DecodeException
	 *             The barcode could be detected but there was an error with the
	 *             decoding.
	 */
	public byte[] decode(int[] source) throws NotDetectedException,
			DecodeException;
}
